package cn.piggy.quartz.task;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;


@Component
public class TestTask extends QuartzJobBean {
    private final Logger logger = LoggerFactory.getLogger(TestTask.class);

    @Override
    protected void executeInternal(@NonNull JobExecutionContext context) {
        try {
            Thread.sleep(500);
            logger.info(Thread.currentThread().getName() + " TestTask --> executeInternal");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
